<?php

namespace App\Http\Controllers\Platform\Doc;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\Common\DataResource;
use App\Models\Game\Platform\Doc\Doc;

class DocController extends Controller
{

    /**
     * 获取数据
     */
    public function getData(Request $request)
    {
        $this->validate($request, [
            'tree_id' => 'required|integer|min:1'
        ]);
        $treeId = $request->input('tree_id');

        $doc = Doc::where('tree_id', $treeId)->firstOrFail('md');

        return new DataResource($doc);
    }
}
